Getting weird results with my ds_hsab emu, trying to sanity test what I have.
In [1]:
%matplotlib inline
from matplotlib import pyplot as plt
In [2]:
import h5py
from os import path
import numpy as np
In [3]:
aemulator_dir = '/home/users/swmclau2/scratch/Aemulators/'
In [4]:
ds_hsab = h5py.File(path.join(aemulator_dir, 'ds_hsab/PearceDsHSABCosmo.hdf5'), 'r')
In [5]:
ds_hsab_test = h5py.File(path.join(aemulator_dir, 'ds_hsab_test/PearceDsHSABCosmoTest.hdf5'), 'r')
In [6]:
ds_hsab_test2 = h5py.File(path.join(aemulator_dir, 'ds_hsab_test2/PearceDsHSABCosmoTest.hdf5'), 'r')
In [7]:
ds_hsab.attrs['cosmo_param_names']
Out[7]:
In [8]:
ds_hsab_test2.attrs['cosmo_param_names']
Out[8]:
In [9]:
ds_hsab_data = np.zeros((40, 1000, 18))
for i in xrange(40):
ds_hsab_data[i] = ds_hsab['cosmo_no_%02d'%i]['a_1.000']['obs'][()]
In [10]:
ds_hsab_test_data = np.zeros((35, 100, 18))
for i in xrange(35):
ds_hsab_test_data[i] = ds_hsab_test['cosmo_no_%02d'%i]['a_1.000']['obs'][()]
In [11]:
ds_hsab_test2_data = np.zeros((35, 100, 18))
for i in xrange(35):
ds_hsab_test2_data[i] = ds_hsab_test2['cosmo_no_%02d'%i]['a_1.000']['obs'][()]
In [12]:
r_bins = np.logspace(-1, 1.6, 19)
rbc = (r_bins[1:] +r_bins[:-1])/2.0
In [39]:
N = 5
for i in xrange(0,35,N):
plt.plot(rbc, ds_hsab_test2_data[i:i+N].mean(axis = (0,1)), label = i)
denom = ds_hsab_data.mean(axis = (0,1))
plt.legend(loc='best')
plt.plot(rbc, denom, ls = '--', lw=10)
plt.xscale('log')
In [14]:
np.any(np.all(ds_hsab_data==0.0, axis = 2))
Out[14]:
In [16]:
np.any(np.all(ds_hsab_test2_data==0.0, axis = 2))
Out[16]:
In [14]:
from pearce.mocks.kittens import TrainingBox
In [15]:
cat = TrainingBox(0)
In [16]:
cat.load(1.0, HOD='hsabZheng07', particles=True, hod_kwargs={'sec_haloprop_key':'halo_local_density_10'})
In [31]:
ds_hsab.attrs['hod_param_vals'][1]
Out[31]:
In [32]:
hod_pnames = ds_hsab.attrs['hod_param_names']
hod_dict = dict(zip(hod_pnames, ds_hsab.attrs['hod_param_vals'][1]))
In [33]:
hod_dict
Out[33]:
In [34]:
ds_hsab_data.shape
Out[34]:
In [35]:
cat.populate(hod_dict, min_ptcl=100)
In [ ]:
ds = cat.calc_ds(r_bins, n_cores = 1)
In [ ]:
ds
In [ ]:
denom = ds_hsab_data.mean(axis = (0,1))
plt.plot(rbc, ds_hsab_data[0,1])
plt.plot(rbc, np.log10(ds) )
plt.xscale('log')
In [ ]: